package main

import (
	"fmt"
)

/**
 * @author: guangcheng
 * @date:   2020/11/23 11:32
 * @version  V1.0
 * @description:
 *
 */
func main() {
	var cp Computer
	var cm Camera
	cp.Working(cm)

	fmt.Println("-------------------")
	var mp3 Mp3
	cp.Working(mp3)
}

//定义接口
type Usb interface {
	Start()
	Stop()
}

//定义实现
type Camera struct {
}

func (c Camera) Start() {
	fmt.Println("相机启动...")
}
func (c Camera) Stop() {
	fmt.Println("相机关闭...")
}

//
type Mp3 struct {
}

func (mp3 Mp3) Start() {
	fmt.Println("mp3启动...")
}
func (mp3 Mp3) Stop() {
	fmt.Println("mp3关闭...")
}

//
type Computer struct {
}

func (cp Computer) Working(usb Usb) {
	usb.Start()
	usb.Stop()
}
